home *** CD-ROM | disk | FTP | other *** search
- Path: gambier.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Kind of an annoying question...
- Date: 15 Mar 1996 09:59:08 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4icb5cINN6pq@gambier.ugrad.cs.ubc.ca>
- References: <4hvrio$c4k@lastactionhero.rs.itd.umich.edu> <4iaqd4$l70@cs3.brookes.ac.uk> <m.b.greenwood-1503961312510001@mac007016.shef.ac.uk>
- NNTP-Posting-Host: gambier.ugrad.cs.ubc.ca
-
- In article <m.b.greenwood-1503961312510001@mac007016.shef.ac.uk>,
- Mike Greenwood <m.b.greenwood@sheffield.ac.uk> wrote:
-
- >ALERT ALERT ALERT !!!!
- >
- >Fine if it works, but getch() is _NOT_ ansi standard. Beware UNIX users,
- >it's not as simple as all this. See the UNIX FAQ for a cheat way round
- >this, but I still haven't managed to figure it out the 'proper way'.
-
- The curses library of UNIX has a getch() function. You have to set up the
- terminal first:
-
- #include <curses.h>
-
- int main()
- {
- int c;
-
- initscr(); /* initialize curses */
- nonl(); /* unset newline mapping */
- cbreak(); /* turn off input line processing */
- noecho(); /* hmm, what do you think? */
-
- /* now use getch() for blocking keyboard reads */
- /* select() for polling */
-
- c = getch();
-
- endwin(); /* restore the terminal, shut down curses */
- }
-
- None of this stuff is part of the C standard, however. The curses library
- supports multiple platforms however, including ones that also have ad-hoc
- methods for doing the same thing.
- --
-
-